package by.bsu.fpmi.bbtp.controllers;

import by.bsu.fpmi.bbtp.authentication.AllowedRoles;
import by.bsu.fpmi.bbtp.authentication.Role;
import by.bsu.fpmi.bbtp.entities.Client;
import by.bsu.fpmi.bbtp.entities.ClientHead;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import java.util.List;

@WebService
@SOAPBinding(style= SOAPBinding.Style.RPC)
@AllowedRoles({Role.SALESMAN, Role.CATALOG_MANAGER})
public interface ClientController {

    @WebMethod
    public void saveClient(@WebParam(name = "sessionId") String sessionId,
                           @WebParam(name = "client") Client client);

    @WebMethod
    public Client getClient(@WebParam(name = "sessionId") String sessionId,
                            @WebParam(name = "clientId") long clientId);

    @WebMethod
    public List<ClientHead> getClientsList(@WebParam(name = "sessionId") String sessionId);

    @WebMethod
    public void deleteClient(@WebParam(name = "sessionId") String sessionId,
                             @WebParam(name = "clientId") long clientId);

    @WebMethod
    public boolean clientExists(@WebParam(name = "sessionId") String sessionId,
                                @WebParam(name = "email") String email);

    @WebMethod
    public Client findByEmail(@WebParam(name = "sessionId") String sessionId,
                              @WebParam(name = "email") String email);
}
